﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace coliseu.BussinessLayer
{
    public class CargoBL
    {
        private coliseuEntities cEntities;

        public CargoBL()
        {

            cEntities = new coliseuEntities(Properties.Settings.Default.conn_coliseu);
        }

        public List<cargo> selecionar()
        {
            return (from x in cEntities.cargo select x).ToList();
        }
      
        public void salvar(cargo c, string tipo)
        {

            if (tipo == "insert")
            {
                cEntities.AddTocargo(c);
            }
            else
            {
                cEntities.cargo.ApplyCurrentValues(c);
            }
            cEntities.SaveChanges();
        }

        public void excluir(cargo b)
        {
            cEntities.cargo.DeleteObject(b);
            cEntities.SaveChanges();
        }
    }
}
